/*
 * @Author: your name
 * @Date: 2021-11-10 08:34:30
 * @LastEditTime: 2021-12-27 15:08:27
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \li-yuwei\egg-example\app\service\login.js
 */

const Service = require("egg").Service;
const timeFormart = require("../extends/timeFormart");
class DemandService extends Service {
    //获取列表
    async getAskBuyList() {
            const { ctx, app } = this;
            let res = await app.mysql.select("askbuy");
            return res;
        }
        //搜索列表
    async searchAskBuyList() {
        const { ctx, app } = this;
        const { type, area } = ctx.query;
        let res = await app.mysql.select("askbuy");
        console.log(type, area);
        if (type) {
            res = res.filter((item) => item.property === type);
        }
        if (area) {
            res = res.filter((item) => item.area === area);
        }
        return res;
    }
}
module.exports = DemandService;